package com.ljt.kotlinandmvvm.recharge

import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.ljt.base.activity.BaseActivity
import com.ljt.kotlinandmvvm.R
import com.ljt.kotlinandmvvm.bean.RechargeBean
import com.ljt.kotlinandmvvm.databinding.ActivityRechargeBinding
import com.ljt.kotlinandmvvm.recharge.adapter.RechargeAdapter
import kotlinx.android.synthetic.main.draw_module_title.view.*

/**
 * @auther :lujiantao
 * @date :2024/5/4 6:01 PM
 * @desc :充值
 */
class RechargeActivity :BaseActivity<ActivityRechargeBinding,RechargeViewModel>(),
    View.OnClickListener {

    private var listStr:ArrayList<RechargeBean> = ArrayList()
    private lateinit var adapter: RechargeAdapter

    override fun getLayoutResId(): Int {
        return R.layout.activity_recharge
    }

    override fun createViewModel(): RechargeViewModel {
        return RechargeViewModel()
    }

    override fun initView() {
        binding.ilModuleTitle.tvModuleTitle.text = "充值"
        binding.ilModuleTitle.ivModuleBack.setOnClickListener(this)
    }

    override fun initData() {
        listStr.add(RechargeBean(R.drawable.weixin,"微信",false))
        listStr.add(RechargeBean(R.drawable.zhifubaozhifu,"支付宝",false))
        listStr.add(RechargeBean(R.drawable.zhongguojiaotongyinhang,"中国交通银行",false))
        listStr.add(RechargeBean(R.drawable.zhongguonongye,"中国农业银行",false))
        listStr.add(RechargeBean(R.drawable.zhongguoyinhang,"中国银行",false))
        listStr.add(RechargeBean(R.drawable.zhongguojianshe,"中国建设银行",false))

        adapter = RechargeAdapter(listStr)
        binding.rlModule.layoutManager = LinearLayoutManager(this)
        binding.rlModule.adapter = adapter

    }

    override fun onClick(v: View?) {
        var id = v?.id
        if(id == R.id.ivModuleBack){
            finish()
        }
    }
}